<!--
 * @Descripttion : FOXCMS是一款高效的PHP多端跨平台内容管理系统
 * @Author       : FoxCMS Team
 * @Date         : 2023-01-10 09:50:26
 * @version      : V1.08
 * @copyright    : ©2021-现在 贵州黔狐科技股份有限公司 版权所有
 * @LastEditTime : 2024-02-23 14:24:33
-->
<!DOCTYPE html>
<html lang="cn">
	<head>
		{include file="header"/}
		<title>[$article.title]-{fox:basic name='title'/}</title>
		<meta name="keywords" content="[$article.keywords]" />
		<meta name="description" content="[$article.description]" />
	</head>
	<body>
		<!-- 顶部 -->
		<header class="foxui-border-bottom foxui-bg-white">{include file="nav"/}</header>
		<!-- 主体内容 -->
		<main>
			{include file="colbg"/}
			<!-- 内容 -->
			<div class="foxcms-container">
				<div class="foxui-row foxui-gutter-20">
					<div class="foxui-col-xs-24 foxui-col-md-4">{include file="banner"/}</div>
					<div class="foxui-col-xs-24 foxui-col-md-20">
						<div class="foxcms-body-container">
							<ul class="foxui-breadcrumb content-separator">
								{fox:positionshut name='field'}
								<li class="foxui-breadcrumb-item" data-content=">">
									<a href="[$field.link]">[$field.name]</a>
								</li>
								{/fox:positionshut}
							</ul>
							<div class="foxcms-content-container">
								<div class="article">
									<h1>[$article.title]</h1>
									<div class="info">
										<p>日期：<span>[$article.release_time|date='Y-m-d H:m']</span></p>
										<p>浏览量：<span>[$article.click]</span></p>
									</div>
								</div>
								{if $article.content}
								<!-- 如果 title 字段有值，显示标题 -->
								<div class="content">[$article.content]</div>
								{else}
								<!-- 如果 title 字段没有值，显示默认文本 -->
								<div class="document"><iframe src="/pdfjs/web/viewer.html?file=[$article.file_url]" frameborder="0"></iframe></div>
								{/if}

								{if $article.file_url}
								<div class="download">
									<button class="foxui-solid-primary foxui-shape-round foxui-size-medium" data-target="{if $article.file_type==1}webLoad{else/}localLoad{/if}"
										data-href="[$article.file_url]">
										<i class="foxui-icon-xiazai-o"></i>
										<span>[$article.title]</span>
									</button>
								</div>
								{/if}
							</div>
						</div>
					</div>
				</div>
			</div>
		</main>
		<!-- 底部 -->
		<footer>{include file="footer"/}</footer>
	</body>
	<script src="_STATIC_/skin/js/foxui-1.21.min.js"></script>
	<script src="_STATIC_/skin/js/common.js"></script>
	<script>
		$(document).on('click', 'button[data-target=localLoad]', function(e) {
			let href = $(e.currentTarget).attr('data-href');
			window.open(href, '_blank');
		});
		$(document).on('click', 'button[data-target=webLoad]', function(e) {
			let href = $(e.currentTarget).attr('data-href'),
				pwd = $(e.currentTarget).attr('data-pwd'),
				title = $(e.currentTarget).attr('data-disk');

			foxui.dialog({
				title,
				content: _webloadHtml(href, pwd),
				confirmText: '前往下载',
				cancelText: '关闭',
				border: true,
				longButton: true,
				buttonAlign: 'center',
				buttonSize: 'small',
				className: 'download-dialog',
				confirm: function(callback) {
					window.open(href + '?pwd=' + pwd, '_blank');
				},
			});
		});
		$(document).on('click', 'button[data-target=webLoad-h5]', function(e) {
			let href = $(e.currentTarget).attr('data-href'),
				pwd = $(e.currentTarget).attr('data-pwd');

			window.open(href + '?pwd=' + pwd, '_blank');
		});

		function _webloadHtml(href, pwd) {
			return [
				'<div class="download-dialog_body">',
				'<ul>',
				'<li>',
				'<div class="label">链接：</div>',
				`<div class="link">${href}</div>`,
				'</li>',
				'<li>',
				'<div class=label>提取码：</div>',
				`<div class="pwd">${pwd}</div>`,
				'</li>',
				'</ul>',
				'</div>',
			].join('');
		}
	</script>
</html>